﻿<!--main content-->
<!-- expects @fandoms, @works, @series, @bookmarks -->
  <% unless @fandoms.empty? %>
  <div class="fandom module" id="user-fandoms">
    <h3><%= ts("Fandoms") %></h3>
    <ul class="index">
      <% @fandoms.each_with_index do |fandom, i| %>
        <% if !params[:expand_fandoms] && i > (ArchiveConfig.NUMBER_OF_ITEMS_VISIBLE_IN_DASHBOARD - 1) %>
          <li class='hidden'>
        <% else %>
          <li>
        <% end %>       
        <% if fandom.merger %>
          <%= link_to fandom.name, {:controller => :works, :user_id => @user, :pseud_id => @author, :selected_tags => [fandom.merger.id]} %> (<%= fandom.work_count %>)
        <% else %>
          <%= link_to fandom.name, {:controller => :works, :user_id => @user, :pseud_id => @author, :selected_tags => [fandom.id]} %> (<%= fandom.work_count %>)
        <% end %>
        </li>
     <% end %>
     <% if @fandoms.length > ArchiveConfig.NUMBER_OF_ITEMS_VISIBLE_IN_DASHBOARD %> 
        <li>
          <% if params[:expand_fandoms] %>
          <%= link_to "< Hide full list", [@user, @author], :id => "expandable-link" %>
          <% else %>
          <%= link_to "> Expand full list", url_for(:expand_fandoms => true), :id => "expandable-link" %>
          <% end %>
        </li>
      <% end %>
    </ul>
  </div>
  <% end %> 
              
  <% unless @works.blank? %>
  <div class="work module<% if current_user == @user %> works-own<% end %>" id="user-works">
    <h3><%=h ts("Recent works") %></h3>
    <ul class="index">
      <% for work in @works %>
    	  <%= render :partial => 'works/work_blurb', :locals => {:work => work} %>
      <% end %>
    </ul>
    <% if @works.count > ArchiveConfig.NUMBER_OF_ITEMS_VISIBLE_IN_DASHBOARD %>
      <ul class="navigation"><li><%= @author ? print_pseud_works_link(@author) : print_works_link(@user) %></li></ul>
    <% end %>
  </div>
  <% end %>
  
  <% unless @series.blank? %>
  <div class="series module<% if current_user == @user %> works-own<% end %>" id="user-series">
    <h3><%=h ts("Recent series") %></h3>
    <ul class="index">
      <% for series in @series %>
        <%= render :partial => 'series/series_blurb', :locals => {:series => series} %>
      <% end %>
      <% if @author %>
        <% if @author.series.count > ArchiveConfig.NUMBER_OF_ITEMS_VISIBLE_IN_DASHBOARD %>
        <ul class="navigation"><li><%= print_pseud_series_link(@author) %></li></ul>
        <% end %>
      <% else %>
        <% if @user.series.count > ArchiveConfig.NUMBER_OF_ITEMS_VISIBLE_IN_DASHBOARD %>
        <ul class="navigation"><li><%= print_series_link(@user) %></li></ul>
        <% end %>
      <% end %> 
    </ul>
    
  </div>
  <% end %>
  
  <% unless @bookmarks.blank? %>
  <div class="bookmark module" id="user-bookmarks">
    <h3><%=h ts("Recent bookmarks") %></h3>
    <ul class="index">
      <% for bookmark in @bookmarks %>
        <%= render :partial => 'bookmarks/bookmark', :locals => {:bookmark => bookmark} %>
      <% end %>
      <% unless @user == User.orphan_account %>
        <% if @author %>
          <% if @author.bookmarks.visible.size > ArchiveConfig.NUMBER_OF_ITEMS_VISIBLE_IN_DASHBOARD %>
            <ul class="navigation"><li><%= print_pseud_bookmarks_link(@author) %></li></ul>
          <% end %>
        <% else %>
          <% if @user.bookmarks.visible.size > ArchiveConfig.NUMBER_OF_ITEMS_VISIBLE_IN_DASHBOARD %>
            <ul class="navigation"><li><%= print_bookmarks_link(@user) %></li></ul>
          <% end %>
        <% end %> 
      <% end %>
    </ul>
  </div>
  <% end %>

<% if @works.blank? && @series.blank? && @bookmarks.blank? %>
  <% if current_user == @user %>
    <p class="alt message">
      <%= ts("You don't have anything posted under this name yet. ") %>
      <%= ts("Would you like to ")%>
      <%= link_to ts("post a new work"), new_work_path %>
      <%= ts("or maybe")%>
      <%= link_to ts("a new bookmark"), new_external_work_path %>?
    </p>
  <% else %>
    <p class="alt message">There are no works or bookmarks under this name yet.</p>
  <% end %>
<% end %>
<!--/content-->
